import Vue from 'vue'
import VueRouter from 'vue-router'

Vue.use(VueRouter)

const routes = [
  {
    path: '/',
    redirect: '/index'
  },
  {
    path: '/index',
    component: () => import('../views/Index'),
    redirect: '/index/housing',
    children: [
      {
        //房源管理
        path: 'housing',
        component: () => import('../views/Index/Housing'),
        meta:
        {
          author:["管理员"],
          name:'房源管理'
        }      
      },
      {
        //直播
        path: 'broadcasting',
        component: () => import('../views/Index/Broadcasting'),
        meta:
        {
          author:["用户","管理员"],
          name:'直播管理'
        }
      },
      {
        //团购
        path: 'grouppurchase',
        component: () => import('../views/Index/Grouppurchase'),
        meta:
        {
          author:["用户","管理员"],
          name:'团购管理'
        }
      },
      { 
        //审核
        path: 'audit',
        component: () => import('../views/Index/Audit'),
        meta:
        {
          author:["用户","管理员"],
          name:'审核管理'
        }
      },

      {
        //订单管理
        path: 'order',
        component: () => import('../views/Index/Order'),
        meta:
        {
          author:["管理员"],
          name:'订单管理'
        }
      },
      {

        //资讯
        path: 'information',
        component: () => import('../views/Index/Information'),
        meta:
        {
          author:["管理员"],
          name:'咨询管理'
        }
      },
      {
        // 经纪人
        path: 'broker',
        component: () => import('../views/Index/Broker'),
        meta:
        {
          author:["管理员"],
          name:'经纪人管理'
        }
      }
    ]
  },
  {
    //登录
    path: '/login',
    component: () => import('../views/Login'),
  },
  ,
  {
    //详情
    path: '/detail/:id',
    component: () => import('../views/Detail'),
  }
]

const router = new VueRouter({
  mode: 'history',
  base: process.env.BASE_URL,
  routes
})
export {routes

}
export default router
